# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2021年12月02日
"""
import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.random([5, 5]),
                                   columns=['A1','A2','A3','A4','A5'])
# df['百分比'] = df['A1'].apply(lambda x: format(x, '.0%')) # 将整列保留0位小数
# df['百分比'] = df['A1'].apply(lambda x: format(x, '.2%')) # 将整列保留2位小数
df['百分比'] = df['A1'].map(lambda x:'{:.0%}'.format(x)) # 使用map函数整列保留0位小数
print(df)